//
//  tabbarViewController.swift
//  zhichidata
//
//  Created by joke on 15/12/22.
//  Copyright © 2015年 joke. All rights reserved.
//

import UIKit
@objc protocol MyDelegate {
    optional func dataReceive()
}

class newTabbarViewController: UITabBarController,UITabBarControllerDelegate{
    
    
    
    let thirdViewController = ThirdViewController()
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        print(12)
        self.selectedIndex=0
        self.delegate = self
        // Do any additional setup after loading the view, typically from a nib.
    }
    
//    override func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
//        let now = self.presentationController?.presentedView()?.tag
//        let view = self.selectedViewController?.title
//        print(view,now)
//    }
    
    func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
        let currentIndex = selectedIndex
        switch(currentIndex){
        case 0:
            print(0)
        case 1:
            print(1)
        case 2:
            print(2)
        default:
            print("nil")
        }
        
    }
    
    
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}